package com.example.manage_c20086.cutil;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.MultiValueMap;

import java.util.Set;

public class cTool {
    public static <T>void jsonToMap(T object, MultiValueMap<String, Object> map) {
        String json = JSONObject.toJSONString(object);
        JSONObject jsonObject = JSON.parseObject(json);
        Set<String> keySet = jsonObject.keySet();
        for (String key : keySet) {
            map.add(key,jsonObject.get(key));
        }
    }
}
